package(
    default_visibility = ["//visibility:public"],
)

licenses(["notice"])  # Apache 2.0

load(
    "//mace:mace.bzl",
    "apu_version_select",
    "if_android",
    "if_android_armv7",
    "if_apu_enabled",
    "if_bfloat16_enabled",
    "if_fp16_enabled",
    "if_neon_enabled",
    "if_opencl_enabled",
    "if_quantize_enabled",
    "if_rpcmem_enabled",
)

cc_library(
    name = "core",
    srcs = glob(
        [
            "*.cc",
            "flow/*.cc",
            "ops/*.cc",
            "registry/*.cc",
            "runtime/*.cc",
            "buffer/*.cc",
            "memory/*.cc",
            "memory/rpcmem/*.cc",
            "proto/*.cc",
            "net/*.cc",
        ],
    ),
    hdrs = glob(
        [
            "*.h",
            "flow/*.h",
            "ops/*.h",
            "registry/*.h",
            "runtime/*.h",
            "memory/*.h",
            "memory/rpcmem/*.h",
            "proto/*.h",
            "net/*.h",
        ],
    ),
    copts = [
        "-Werror",
        "-Wextra",
        "-Wno-missing-field-initializers",
    ] + if_quantize_enabled([
        "-DMACE_ENABLE_QUANTIZE",
    ]) + if_bfloat16_enabled([
        "-DMACE_ENABLE_BFLOAT16",
    ]) + if_fp16_enabled([
        "-DMACE_ENABLE_FP16",
        "-march=armv8.2-a+fp16",
    ]) + if_neon_enabled([
        "-DMACE_ENABLE_NEON",
    ]) + if_opencl_enabled([
        "-DMACE_ENABLE_OPENCL",
    ]) + if_apu_enabled([
        "-DMACE_ENABLE_MTK_APU",
    ]) + if_android_armv7([
        "-mfpu=neon-fp16",
        "-mfloat-abi=softfp",
    ]) + if_rpcmem_enabled([
        "-DMACE_ENABLE_RPCMEM",
    ]),
    linkopts = ["-ldl"],
    deps = [
        "//mace/codegen:generated_version",
        "//mace/proto:mace_cc",
        "//mace/utils",
        "//mace/port",
        "@half//:half",
    ] + if_quantize_enabled([
        "@gemmlowp",
    ]),
)
